<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<script type="text/javascript" src="<%=request.getContextPath()%>/resources/js/locale/easyui-lang-zh_CN.js"></script>
		<script type="text/javascript">
			$(function() {
				$('#pid').combotree({
					url : '<%=request.getContextPath() %>/role/getRoleList',
					parentField : 'pid',
					idField:'id',
				    textField:'name',
					lines : true,
					panelHeight : 'auto',
					onLoadSuccess : function() {
						parent.$.messager.progress('close');
					}
				});
				
				$('#form').form({
					url : '<%=request.getContextPath() %>/role/saveRole',
					success : function(data) {
						parent.$.messager.progress('close');
						var result = $.parseJSON(data).result;
						if (result) {
							parent.$.modalDialog.roleTree.treegrid('reload');	
							parent.$.modalDialog.handler.dialog('close');
						}
					}
				});
			});
		</script>
	</head>
	<div class="easyui-layout" data-options="fit:true,border:false">
		<div data-options="region:'center',border:false" title="" style="overflow: hidden;">
			<form id="form" method="post" >
				<table class="formtab">
					<tr>
						<th>角色名称</th>
						<td><input name="name" type="text" placeholder="请输入角色名称" 
								   style="width: 180px;" data-options="required:'true',validType:'length[2,30]'"
								   class="easyui-validatebox"></td>
					</tr>
					<tr>
						<th>上级角色</th>
						<td><select id="pid" name="pid" style="width: 185px;"></select></td>
					</tr>
					<tr>
						<th>描&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;述</th>
						<td>
							<textarea name="description" rows="3" style="width: 280px;"
								   data-options="validType:'length[0,100]'"
								   class="easyui-validatebox"></textarea>
						</td>
					</tr>
				</table>
			</form>
		</div>
	</div>
</html>
